﻿'use strict';

(function () {
    var blogApp = angular.module('blogApp', []);

    //blogApp.config(function ($stateProvider, $urlRouterProvider) {

    //    $urlRouterProvider.when("", "/blog");

    //    $stateProvider
    //       .state("blog", {
    //           url: "/api/blog",
    //           templateUrl: "~/BlogApp/templates/BlogList.html"
    //       });
    //});

    blogApp.controller('blogController', ['$http', '$scope', function ($http, $scope) {
        $scope.blogs = [];
        $scope.Load = function () {
            $http.get("/api/blog").success(function (data, status) {

                $scope.blogs = data;
            })
        };
        $scope.Load();

        $scope.delete = function (blogId) {
            $http.get("/api/blog/", { blogId: blogId }).success(function (data, status) {
                $scope.Load();
            })
        };
    }]);
})();